package com.huisheng.web.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.huisheng.web.entity.User;
import com.huisheng.web.mapper.UserMapper;


@Controller
@RequestMapping("/user")
public class UserController {
	@Autowired
	private UserMapper usermapper;
	
	@RequestMapping("/index")
	public String index(HttpServletRequest request, Model model) {
		System.out.println("index");
			return "index";
	}
	@RequestMapping("/login")
	public String login(HttpServletRequest request, Model model) {
		System.out.println("login");
			return "success";
	}

	@RequestMapping(value="/list")
	public String getAllUsers(Model model) {
		List<User> users = usermapper.getAllUsers();
		model.addAttribute("users", users);
		System.out.println(users);
		return "list";

	}
}
